/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package vue;

import actionListeners.ActionAjouterDate;
import actionListeners.ActionLancerCreation;
import java.util.ArrayList;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import org.joda.time.DateTime;

/**
 *
 * @author Simon
 */
public class FenetreCreerBDC extends JFrame {
    
    private JComboBox<String> site;
    
    private JTextField raisonSociale;
    private JTextField adresse;
    private JTextField codePostal;
    private JTextField ville;
    private JTextField nomSignataire;
    
    private JTextField nomIntervenant;
    private JTextField telIntervenant;
    private JTextField emailIntervenant;
    
    private JTextField jour;
    private JTextField mois;
    private JTextField annee;
    private JRadioButton journee;
    private JRadioButton matinee;
    private JRadioButton apresmidi;
    private ArrayList<DateTime> dates;
    private JTextField designation;
    private JComboBox<String> session;
    private JTextField prixUnitaire;
    
    private JRadioButton horaire1;
    private JRadioButton horaire2;
    private JTextField informations;
    private JTextField delaiMinimum;
    private JTextField delaiMaximum;
    private JRadioButton reglement1;
    private JRadioButton reglement2;
    private JTextField observations;

    public FenetreCreerBDC() {
        
        this.setSize(900,900);
        this.setTitle("Logiciel de gestion des bons de commande");
        this.setLocationRelativeTo(null);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        
        JPanel contenu = new JPanel();
        contenu.add(new PanelMenu());
        contenu.add(panelCreation());
        this.setContentPane(contenu);
    }
    
    private JPanel panelCreation() {
        
        JPanel panelSite = new JPanel();
        panelSite.add(new JLabel("Site : "));
        try {
        this.site = new ComboBoxSites();
        panelSite.add(site);
        } catch (Exception e){  
//            manque erreur
        }
        JPanel panelRaisonSociale = new JPanel();
        panelRaisonSociale.add(new JLabel("Raison Sociale : "));
        this.raisonSociale = new JTextField(10);
        panelRaisonSociale.add(raisonSociale);
        
        JPanel panelAdresse = new JPanel();
        panelAdresse.add(new JLabel("Adresse : "));
        this.adresse = new JTextField(20);
        panelAdresse.add(adresse);
        
        JPanel panelCodePostal = new JPanel();
        panelCodePostal.add(new JLabel("Code postal : "));
        this.codePostal = new JTextField(6);
        panelCodePostal.add(codePostal);
        
        JPanel panelVille = new JPanel();
        panelVille.add(new JLabel("Ville : "));
        this.ville = new JTextField(10);
        panelVille.add(ville);
        
        JPanel panelNomSignataire = new JPanel();
        panelNomSignataire.add(new JLabel("Nom du signataire : "));
        this.nomSignataire = new JTextField(20);
        panelNomSignataire.add(nomSignataire);
        
        JPanel panelNomIntervenant = new JPanel();
        panelNomIntervenant.add(new JLabel("Nom de l'intervenant : "));
        this.nomIntervenant = new JTextField(20);
        panelNomIntervenant.add(nomIntervenant);
        
        JPanel panelTelIntervenant = new JPanel();
        panelTelIntervenant.add(new JLabel("Tél. intervenant : "));
        this.telIntervenant = new JTextField(15);
        panelTelIntervenant.add(telIntervenant);
        
        JPanel panelEmailIntervenant = new JPanel();
        panelEmailIntervenant.add(new JLabel("Email intervenant : "));
        this.emailIntervenant = new JTextField(20);
        panelEmailIntervenant.add(emailIntervenant);
        
        JPanel panelDate = new JPanel();
        panelDate.add(new JLabel("Date : "));
        this.jour = new JTextField(2);
        panelDate.add(jour);
        panelDate.add(new JLabel("/"));
        this.mois = new JTextField(2);
        panelDate.add(mois);
        panelDate.add(new JLabel("/"));
        this.annee = new JTextField(4);
        panelDate.add(annee);
        this.journee = new JRadioButton("Journée");
        this.matinee = new JRadioButton("Matinée");
        this.apresmidi = new JRadioButton("Après-midi");
        ButtonGroup periode = new ButtonGroup();
        periode.add(journee);
        periode.add(matinee);
        periode.add(apresmidi);
        panelDate.add(journee);
        panelDate.add(matinee);
        panelDate.add(apresmidi);
        JButton ajouterDate = new JButton("Ajouter cette date");
        ajouterDate.addActionListener(new ActionAjouterDate(this));
        
        JPanel panelDesignation = new JPanel();
        panelDesignation.add(new JLabel("Designation : "));
        this.designation = new JTextField(20);
        panelDesignation.add(designation);
        
        JPanel panelSession = new JPanel();
        panelSession.add(new JLabel("Session : "));
        try {
        this.session = new ComboBoxSessions();
        panelSession.add(session);
        } catch (Exception e){  
//            manque erreur
        }
        
        JPanel panelPrixUnitaire = new JPanel();
        panelPrixUnitaire.add(new JLabel("Prix Unitaire : "));
        this.prixUnitaire = new JTextField(6);
        panelPrixUnitaire.add(prixUnitaire);
        
        JPanel panelHoraires = new JPanel();
        this.horaire1 = new JRadioButton("9h00-12h30/13h30-17h00");
        this.horaire2 = new JRadioButton("9h00-12h00/13h00-17h00");
        ButtonGroup horaires = new ButtonGroup();
        horaires.add(horaire1);
        horaires.add(horaire2);
        panelHoraires.add(horaire1);
        panelHoraires.add(horaire2);
        
        JPanel panelInformations = new JPanel();
        panelInformations.add(new JLabel("Informations : "));
        this.informations = new JTextField(20);
        panelInformations.add(informations);
        
        JPanel paneldelaiMinimum = new JPanel();
        paneldelaiMinimum.add(new JLabel("Delai minimum : "));
        this.delaiMinimum = new JTextField(2);
        paneldelaiMinimum.add(delaiMinimum);
        
        JPanel panelDelaiMaximum = new JPanel();
        panelDelaiMaximum.add(new JLabel("Delai maximum : "));
        this.delaiMaximum = new JTextField(2);
        panelDelaiMaximum.add(delaiMaximum);
        
        JPanel panelReglement = new JPanel();
        this.reglement1 = new JRadioButton("Cheque");
        this.reglement2 = new JRadioButton("Virement");
        ButtonGroup reglement = new ButtonGroup();
        horaires.add(reglement1);
        horaires.add(reglement2);
        panelReglement.add(reglement1);
        panelReglement.add(reglement2);
        
        
        JPanel panelObservations = new JPanel();
        panelObservations.add(new JLabel("Observations : "));
        this.observations = new JTextField(6);
        panelObservations.add(observations);
        
        JButton boutonRechercher = new JButton("Rechercher");
        boutonRechercher.addActionListener(new ActionLancerCreation(this));
        
        JPanel panelFinal = new JPanel();
        panelFinal.add(panelSite);
        panelFinal.add(panelRaisonSociale);
        panelFinal.add(panelAdresse);
        panelFinal.add(panelCodePostal);
        panelFinal.add(panelVille);
        panelFinal.add(panelNomSignataire);
        panelFinal.add(panelNomIntervenant);
        panelFinal.add(panelTelIntervenant);
        panelFinal.add(panelEmailIntervenant);
        panelFinal.add(panelDate);
        panelFinal.add(panelDesignation);
        panelFinal.add(panelSession);
        panelFinal.add(panelPrixUnitaire);
        panelFinal.add(panelHoraires);
        panelFinal.add(panelInformations);
        panelFinal.add(paneldelaiMinimum);
        panelFinal.add(panelDelaiMaximum);
        panelFinal.add(panelReglement);
        panelFinal.add(panelObservations);
        
        return(panelFinal);
    }

    public JComboBox<String> getSite() {
        return site;
    }

    public JTextField getRaisonSociale() {
        return raisonSociale;
    }

    public JTextField getAdresse() {
        return adresse;
    }

    public JTextField getCodePostal() {
        return codePostal;
    }

    public JTextField getVille() {
        return ville;
    }

    public JTextField getNomSignataire() {
        return nomSignataire;
    }

    public JTextField getNomIntervenant() {
        return nomIntervenant;
    }

    public JTextField getTelIntervenant() {
        return telIntervenant;
    }

    public JTextField getEmailIntervenant() {
        return emailIntervenant;
    }

    public JTextField getJour() {
        return jour;
    }

    public JTextField getMois() {
        return mois;
    }

    public JTextField getAnnee() {
        return annee;
    }

    public JRadioButton getJournee() {
        return journee;
    }

    public JRadioButton getMatinee() {
        return matinee;
    }

    public JRadioButton getApresmidi() {
        return apresmidi;
    }

    public ArrayList<DateTime> getDates() {
        return dates;
    }

    public JTextField getDesignation() {
        return designation;
    }

    public JComboBox<String> getSession() {
        return session;
    }

    public JTextField getPrixUnitaire() {
        return prixUnitaire;
    }

    public JRadioButton getHoraire1() {
        return horaire1;
    }

    public JRadioButton getHoraire2() {
        return horaire2;
    }

    public JTextField getInformations() {
        return informations;
    }

    public JTextField getDelaiMinimum() {
        return delaiMinimum;
    }

    public JTextField getDelaiMaximum() {
        return delaiMaximum;
    }

    public JRadioButton getReglement1() {
        return reglement1;
    }

    public JRadioButton getReglement2() {
        return reglement2;
    }

    public JTextField getObservations() {
        return observations;
    }
    
    
}
